Skip to content

Conversation

kocsismate
Copy link
Member

No description provided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ^ character is in the percent-encode set of the path (https://url.spec.whatwg.org/#path-percent-encode-set), but somehow it's not percent-encoded.

@kocsismate kocsismate changed the base branch from master to PHP-8.5 September 26, 2025 07:40
Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through all RFC 3986 tests. Looking pretty good overall, some nits. I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null and "" (e.g. whether there is a ? for the query or not).

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also have a normalizable percent-encoded character similarly to ext/uri/tests/rfc3986/modification/host_success_encoded.phpt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be unresolved still.

@kocsismate
Copy link
Member Author

I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null and "" (e.g. whether there is a ? for the query or not).

Yes, I was also thinking about something similar (at least in some edge cases), but I didn't want to make the output too "crowded". My other concern is that most states can be tested via regular parsing 🤔 (we don't necessary have to use withers for them)

@kocsismate
Copy link
Member Author

@TimWolla What do you think about verifying URI recomposition separately? Or do you think we should always test the recomposed URI after URI modification?

@TimWolla
Copy link
Member

TimWolla commented Oct 4, 2025

Or do you think we should always test the recomposed URI after URI modification?

Always, because this also helps the human reader understand the test better.

@TimWolla
Copy link
Member

TimWolla commented Oct 4, 2025

but I didn't want to make the output too "crowded".

If the tests follow a common structure / order, that's easy to check and scan. You could also insert an additional newline between the various output “sections”.

@nielsdos nielsdos removed their request for review October 4, 2025 23:06
@nielsdos
Copy link
Member

nielsdos commented Oct 4, 2025

Unless I'm really needed here I'm removing my review request.
The honest reason is that I'm not really looking forward to reviewing 2K lines of tests in my spare time 😅

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken another look at the RFC 3986 tests now. Generally LGTM. Will still need to look at the WHATWG tests.

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withHost("t%65st.com"); // test.com
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please use t%65st.example as the replacement to avoid using “legit” domain names?

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be unresolved still.

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withFragment("foo%3dbar"); // foo=bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a second encoding that can be normalized? e.g. %61 for the a.

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withPath("/foo%2Fbar"); // /foo/bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a second encoding that can be normalized? e.g. %61 for the a.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in filename “sensitive”.

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withQuery("foo%3dbar"); // foo=bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a second encoding that can be normalized? e.g. %61 for the a.

<?php

$uri1 = Uri\Rfc3986\Uri::parse("https://example.com");
$uri2 = $uri1->withScheme("http");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$uri2 = $uri1->withScheme("http");
$uri2 = $uri1->withScheme("HTTP");

To allow for normalizing to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants